package com.itheima.dao;

import com.itheima.bean.Brand;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface BrandMapper {

    /**
     * 查询所有的品牌
     */
    @Select("select * from tb_brand")
    List<Brand> selectAll();

    @Insert("insert into tb_brand values(null,#{brandName},#{companyName},#{ordered},#{description},#{status})")
    int add(Brand brand);//返回影响的行数

    @Select("select * from tb_brand where id=#{id}")
    Brand selectById(Integer id);

    @Update("UPDATE tb_brand SET brand_name = #{brandName}, company_name = #{companyName},ordered = #{ordered},description =#{description},STATUS = #{status} WHERE id = #{id}")
    int update(Brand brand);

    @Delete("delete from tb_brand where id=#{id}")
    int deleteById(Integer id);


}
